import request from '@/utils/request'

// 获取订单核心指标
export function getOrderCoreMetrics(params) {
  return request({
    url: '/statistics/order/core-metrics',
    method: 'get',
    params
  })
}

// 获取订单详情列表
export function getOrderDetails(params) {
  return request({
    url: '/statistics/order/details',
    method: 'get',
    params
  })
}

// 获取订单转化漏斗数据
export function getOrderFunnelData(params) {
  return request({
    url: '/statistics/order/funnel',
    method: 'get',
    params
  })
}

// 获取订单金额分布数据
export function getOrderAmountDistribution(params) {
  return request({
    url: '/statistics/order/amount-distribution',
    method: 'get',
    params
  })
}

// 导出订单核心指标数据
export function exportOrderCoreData(params) {
  return request({
    url: '/statistics/order/export/core',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 导出订单漏斗数据
export function exportOrderFunnelData(params) {
  return request({
    url: '/statistics/order/export/funnel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获取订单核心指标（别名）
export function getOrderMetrics(params) {
  return getOrderCoreMetrics(params)
}

// 获取订单趋势数据
export function getOrderTrendData(params) {
  return request({
    url: '/statistics/order/trend',
    method: 'get',
    params
  })
}

// 导出订单数据
export function exportOrderData(params) {
  return exportOrderCoreData(params)
}